package com.labichaoka.chaoka.ui.baseinfo.edu;

import com.labichaoka.chaoka.entity.BaseResponse;
import com.labichaoka.chaoka.entity.IDCardRequest;

/**
 * Created by ruan on 2018/8/9.
 */

public class EducationImgUploadPresenterImpl implements EducationImgUploadPresenter,EducationImgUploadInteractor.OnUploadFinishedListener {

    private EducationImgUploadInteractor interactor;
    private EducationImgUploadView view;

    public EducationImgUploadPresenterImpl(EducationImgUploadInteractor interactor, EducationImgUploadView view) {
        this.interactor = interactor;
        this.view = view;
    }

    @Override
    public void upload(IDCardRequest request) {
        if (view!=null){
            view.showProgress();
        }
        interactor.uploadFile(request,this);
    }

    @Override
    public void onDestroy() {
        view=null;
    }

    @Override
    public void onUploadSuccessed(BaseResponse response) {
        view.hideProgress();
        view.uploadSuccessed();
    }

    @Override
    public void onUploadFailed() {
        view.hideProgress();
    }
}
